package ch.fhnw.qualiscan.core.libraries;

import java.io.Serializable;

import ch.fhnw.qualiscan.ApplicationData;
import ch.fhnw.qualiscan.application.layout.BaseLayout;

import com.vaadin.ui.Window;

import eu.livotov.tpt.TPTApplication;


/**
 * Layout Library attaches the base layout to the application. 
 * @author Kevin Mettenberger, Benjamin Groehbiel
 *
 */

@SuppressWarnings("serial")
public class LayoutLib implements Serializable {
	
	private Window mainWindow;
	
	/**
	 * baseLayout holds all components, defined in
	 * @see ch.fhnw.qualiscan.application.layout.BaseLayout
	 */
	public BaseLayout baseLayout;
	public ApplicationData dataObject;
    
    /**
     * This functions loads the base layout of the application.
     */
    public void init() {
    	mainWindow = TPTApplication.getCurrentApplication().getMainWindow();
    	baseLayout = new BaseLayout();
    	dataObject = (ApplicationData) mainWindow.getData();
    	dataObject.setBaseLayout(baseLayout);
    	mainWindow.addComponent(baseLayout);
    }
    
}
